<script lang="ts" setup>
import { ref } from 'vue'
const dialogVisible = ref<boolean>(false)
const remark = ref<string>('')
const workOrderId = ref<string>('')
const title = ref<string>('')
const open = () => {
  dialogVisible.value = true
}
const setId = (id: string, t: string) => {
  title.value = t
  workOrderId.value = id
}
const close = () => {
  remark.value = ''
  dialogVisible.value = false
}
const emit = defineEmits(['submit'])
defineExpose({ open, setId, close })

const submit = async () => {
  if (!remark.value) {
    return
  }
  emit('submit', workOrderId.value, remark.value)
}
</script>

<template>
  <el-dialog :title="title" center v-model="dialogVisible" width="500px">
    <el-input type="textarea" v-model="remark" :autosize="{ minRows: 10 }" />
    <template #footer>
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="submit">确 定</el-button>
    </template>
  </el-dialog>
</template>

<style scoped>
.el-select {
  width: 100%;
}
</style>
